# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ruby-bacon-colored_output
pkgver=1.1.1
_commit=e2a8a3cf9a902d2a2e7d644c1d1ff8bcad6843c4
pkgrel=2
pkgdesc='Colored output for Bacon test framework'
arch=(any)
url='https://github.com/whitequark/bacon-colored_output'
license=(MIT)
depends=(ruby-bacon)
makedepends=(git)
options=(!emptydirs)
source=(git+https://github.com/whitequark/bacon-colored_output.git#commit=$_commit)
sha256sums=('SKIP')

build() {
  local _gemdir="$(gem env gemdir)"
  cd bacon-colored_output
  gem build bacon-colored_output.gemspec
  gem install \
    --local \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "tmp_install/$_gemdir" \
    --bindir "tmp_install/usr/bin" \
    bacon-colored_output-$pkgver.gem
  find "tmp_install/$_gemdir/gems/" \
    -type f \
    \( \
        -iname "*.o" -o \
        -iname "*.c" -o \
        -iname "*.so" -o \
        -iname "*.time" -o \
        -iname "gem.build_complete" -o \
        -iname "Makefile" \
    \) \
    -delete
  rm -r tmp_install/$_gemdir/cache
}

check() {
  local _gemdir="$(gem env gemdir)"
  cd bacon-colored_output
  # No tests
}

package() {
  cd bacon-colored_output
  cp -a tmp_install/* "$pkgdir"/
  install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname
}
